import React, { useState, useEffect } from "react";
import style from "../css/Home.module.css";
import { Grid, Image } from "react-vant";
import { useNavigate } from "react-router-dom";

export default ({ list }) => {
    let navigate=useNavigate()
    let btn = (id) => {
        console.log(id);//这里需要点击跳转
        navigate(`/post/${id}`)
        console.log(999);

    }
  return (
    <div className={style.dis}>
      {list.map((item) => {
        return (
          <div key={item.id} onClick={()=>{btn(item.id,item.name)}} className={style.key}>
            {" "}
                <Image src={"/api" + item.imgUrl}    />
            <div  className={style.text}>{item.name}</div>
          </div>
        );
      })}
    </div>
  );
};
